<template>
  <div>
    <el-container style="height: 500px; " >
       <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
        <el-menu :default-openeds="['1','2']">
          <el-submenu index="1">
            <template slot="title"><i class="el-icon-message">用户管理</i></template>
            <el-menu-item-group>
              <el-menu-item index="1-1">
                <!--这种写法也行-->
                          <!--:to="{
                          name :"UserProfile",
                          params:{
                            id:1,
                            name:2ww
                          }

                    写法二      to="/user/profile/1" 这种写法要在路由路径中占位置

                          }"-->
                                          
                <router-link :to="{ name :'UserInfo',params:{username:username,id:id}}">个人消息</router-link>
              </el-menu-item>
              <el-menu-item index="1-2">
                <router-link to="/user/list">用户列表</router-link>
                </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title"><i class="el-icon-message">内容管理</i></template>
            <el-menu-item-group>
              <el-menu-item index="2-1">分类管理</el-menu-item>
              <el-menu-item index="2-2">分类列表</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header style="text-align:right; font-size: 12px">
          <el-dropdown>
            <i class="el-icon-setting" style="margin-right: 15px"></i>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>个人信息</el-dropdown-item>
              <el-dropdown-item><router-link to="/logout">退出登录</router-link></el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <!--取store 里面的值-->
          <span>{{$store.getters.gettUser.username}}</span>
        </el-header>
           <el-main>

          <!--因为要在这里面显示不同页面的内容  需要配置为路由视图-->
          <router-view/>
                </el-main>
      </el-container>
    </el-container>

  </div>
</template>

<script>
  export default {
    name: "Main",
    props:['username','id'],
    
  }
</script>

<style scoped>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }

  .el-aside {
    color: #333;
  }
</style>
